﻿@using ZhouYu.DreamTour.Model;
@using ZhouYu.DreamTour.Web.Models;
@{
    var user = ViewBag.user as UserInfo;
    var UserInfo = UserInfoContext.userInfoContext.UserInfo;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>中国梦想游-会员登录页</title>
    <link href="~/css/style.css" rel="stylesheet" type="text/css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <link href="~/layui-v2.5.4/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="~/layui-v2.5.4/layui/css/modules/layer/default/layer.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="~/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="~/layui-v2.5.4/layui/layui.js"></script>
    <script type="text/javascript" src="~/layui-v2.5.4/layui/lay/modules/layer.js"></script>
    <script type="text/javascript" src="~/js/Format.js"></script>
</head>
<body>
    <div class="top_hw clearfix">
        <div class="top_h clearfix">
            <div class="top_hl"><span>欢迎来到中国梦想游，让你的梦想全程免费自由行！</span> 预定热线：<b>0571-63322269</b></div>
            <div class="top_hr">
                @if (UserInfo == null)
                {
                    <a href="/Home/User_Register">会员注册</a>
                    <span>|</span> <a href="/Home/User_Login">登录</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a>
                    @*<a>
                欢迎你，来到新世界旅行网！
            </a>*@
                }
                else
                {
                    <a href="/Home/User_Center">会员中心</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a> <span>|</span> <a href="/Login/LoginOut">退出</a> <span>|</span>
                    <a>
                        欢迎你，<span>@UserInfo.User_Name</span>来到新世界旅行网！
                    </a>
                }
            </div>
        </div>
    </div>
    <div class="head_w">
        <div class="head_t clearfix">
            <div class="logo"><img src="~/images/logo.jpg"></div>
            <div class="rx_line"><img src="~/images/rx.jpg"></div>
        </div>
    </div>
    <div class="mainNav clearfix">
        <ul class="Nav_ul">
            <li><a href="/Home/Index">首页</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Route">旅游路线</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Scenic">旅游景点</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/CateringAccommodation">餐饮住宿</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Traffic_DatailsOne">交通线路</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Group">旅游团购</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Specialty">地方特产</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/AutoGenerationIntro">自动生成简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Team_Join">团队简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Itinerary_Details">行程导航</a></li>
        </ul>
    </div>
    <div class="b_wrap">
        <div class="current"><span>当前所在地：</span><a href="/Home/Index">首页</a> >> <a href="/Home/User_Center">会员中心</a></div>
        <div class="fmember">
            <div class="fmleft">
                <div class="fmleft_top"><img src="~/images/fmbt1.png" border="0"></div>
                <div class="fmlist">
                    <ul>
                        <li class="f1">订单中心</li>
                        <li> >><a href="/Home/User_Order">我的订单</a> </li>
                        <li> >><a href="/Home/User_Colleague">发布结伴同行</a> </li>
                        <li> >><a href="/Home/User_Apply">我申请的结伴同行</a> </li>
                        <li> >><a href="/Home/User_Comment">我的点评</a> </li>
                        <li class="f2"> >><a href="/Home/User_Questions">我的提问</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">我的优惠卡券</li>
                        <li> >><a href="/Home/User_CashAccount">现金账号</a> </li>
                        <li> >><a href="/Home/User_AllowanceVol">抵用券</a> </li>
                        <li class="f2"> >><a href="/Home/User_TouristVol">旅游券</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">账户信息</li>
                        <li> >><a href="/Home/User_Data">个人资料</a> </li>
                        <li> >><a href="/Home/User_AccountSecurity">账户安全</a> </li>
                        <li>
                            >>
                            <a href="/Home/User_Bank">我的银行卡</a>
                        </li>
                        <li> >><a href="/Home/User_Integral">我的积分</a> </li>
                        <li> >><a href="/Home/User_UpdatePwd">修改密码</a> </li>
                        <li class="f2"> >><a href="/Home/User_Address">配送地址</a> </li>
                    </ul>
                </div>
            </div>
            <div class="fmright">
                <div class="fmr1">
                    <div class="fmr1_top">个人资料</div>
                    <div class="fmr1_m">
                        <p class="fp3">
                            <table border="0" cellpadding="0" cellspacing="0" width="638">
                                <tr>
                                    <td width="100" align="left" height="30">会员名：</td>
                                    <td width="578" align="left" height="30">@user.User_Name @*&nbsp; <span class="fspan9"><a href="#">[修改]</a></span>*@</td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">昵称：</td>
                                    <td width="578" align="left" height="30"><input type="text" id="User_NickName" value="@user.User_NickName" /></td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">真实姓名：</td>
                                    <td width="578" align="left" height="30"><input type="text" id="User_RealName" value="@user.User_RealName" /></td>
                                </tr>

                                <tr>
                                    <td width="100" align="left" height="30">性别：</td>
                                    <td width="578" align="left" height="30">
                                        <input type="hidden" value="@user.User_Sex" id="sex" />
                                        <select id="User_Sex">
                                            <option value="2">请选择性别</option>
                                            <option value="0">男</option>
                                            <option value="1">女</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">出生日期：</td>
                                    <td width="578" align="left" height="30"><input type="text" id="User_Birthday" value="@user.User_Birthday"></td>
                                </tr>
                                <tr>
                                    <td width="100" align="left" height="30">居住地址：</td>
                                    <td width="578" align="left" height="30"><input type="text" id="User_Adress" value="@user.User_Adress"></td>
                                </tr>
                                <tr>
                                    <td colspan="2" height="30">提示：<span class="fspan9"> 您的资料将被默认保存为第一游客信息，请您完整如实填写，避免资料不实带来的不便。</span></td>
                                </tr>
                                <tr>
                                    <td colspan="2" height="30"><input type="image" id="commit" src="~/images/fbtn2.png"></td>
                                </tr>
                            </table>
                        </p>

                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    //layui时间控件
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        var date = Format($("#User_Birthday").val(), "yyyy-MM-dd ");
        //执行一个laydate实例
        laydate.render({
            elem: '#User_Birthday' //指定元素
            , value: date
            , max: 0
        });
    });

    var key = $("#sex").val();
    //根据值让option选中
    $("#User_Sex option[value='" + key + "']").attr("selected", "selected");



    //保存提交按钮点击事件
    $("#commit").click(function () {
        var data = {};
        data.User_NickName = $("#User_NickName").val();
        data.User_RealName = $("#User_RealName").val();
        data.User_Sex = $("#User_Sex").val();
        data.User_Adress = $("#User_Adress").val();
        data.User_Birthday = $("#User_Birthday").val();
        $.ajax({
            url: "/User/EditUserInfo",
            type: "post",
            data: data,
            success: function (result) {
                if (result.Success) {
                    layer.msg('修改成功！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    }, function () {
                        location.reload(true);
                    });
                }
                else {
                    layer.msg('修改失败！', {
                        title: '提示框',
                        icon: 1,
                        time: 2000
                    });
                }
            }
        });
    });

</script>
</html>

